import xadmin
from xadmin import views
from .models import *


class BaseSetting(object):
    enable_themes = True
    use_bootswatch = True


class GlobalSettings(object):
    site_title = "原生态博客"
    site_footer = "yst"
    menu_style = "accordion"


class UserExtraConfig(object):
    list_display = ['user', 'blog_num', 'fans_num', 'like_num', 'comment_num', 'level', 'visit', 'integral', 'ranking',
                    'register_id', 'last_loigin_ip', 'create_at', 'update_at']
    search_fields = ['user', 'blog_num', 'fans_num', 'like_num', 'comment_num', 'level', 'visit', 'integral', 'ranking',
                     'register_id', 'last_loigin_ip']
    list_filter = ['user', 'blog_num', 'fans_num', 'like_num', 'comment_num', 'level', 'visit', 'integral', 'ranking',
                   'register_id', 'last_loigin_ip', 'create_at', 'update_at']
    show_bookmarks = False
    readonly_fields = ['blog_num', 'fans_num', 'like_num', 'comment_num', 'level', 'visit', 'integral', 'ranking',
                       'register_id', 'last_loigin_ip']
    model_icon = 'fa fa-user-plus'


xadmin.site.register(UserExtra, UserExtraConfig)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
